home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / OutOfContextMenus / Read Me < prev    next >
Encoding:
Text File  |  1999-06-25  |  1.6 KB  |  41 lines  |  [TEXT/CWIE]

  1. Out Of Context Menus
  2. by Eric Traut
  3. 1999 MacHack Programming Contest
  4.  
  5.  
  6. Out Of Context Menus is an application (built using PowerPlant) that
  7. adds out-of-place contextual menu items to the Finder.
  8.  
  9. To use: Run "OutOfContext". Flip to the Finder, and control-click on
  10. one of the windows. Try out the various options.
  11.  
  12. Explanation of code: The code consists of a jGNEFilter (which hooks
  13. in and runs at Get/WaitNextEvent time). It waits for the Finder to
  14. be the front process and then begins to filter events - including
  15. control-click events. While the Finder is the front-most app, it
  16. also attempts to maintain a list of "CShadowWindow" objects which
  17. mirror the windows in the Finder's window list. Each window in the
  18. shadow window list can have an attached "behavior". Each behavior
  19. corresponds to a single contextual menu item. For example, one 
  20. causes all data drawn to the Finder window to be displayed in a
  21. blurred fashion. This is accomplished by patching the QuickDraw
  22. bottleneck procs for the window. 
  23.  
  24. The only other scary part of the program is a trap patch on 
  25. WaitNextEvent that is applied within the Finder's context. The
  26. reason for this patch is that the Finder calls WNE with a sleep
  27. time of 60 ticks. This is generally good for other apps in the 
  28. system. But it is not good for windows being animated by OutOfContext.
  29. The patch simply replaces the 60-tick sleep time with a time of
  30. one tick. 
  31.  
  32. All of this code is considered "public domain" and can be used for
  33. any purpose - evil or otherwise. The author, however, is not
  34. responsible for any loss of data, hair, money or anything else
  35. resulting from the execution of this program or the use of the
  36. included code. 
  37.  
  38.  
  39.  
  40.  
  41.